package com.yuanfengerp.basicInfoManage.logisticscompany.controller;


import com.yuanfengerp.basicInfoManage.logisticscompany.moudel.LogisticsCompanyInfo;
import com.yuanfengerp.basicInfoManage.logisticscompany.service.impl.LogisticsCompanyServiceImpl;
import com.yuanfengerp.publicUtil.Result;
//import io.lettuce.core.dynamic.annotation.Param;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
public class LogisticsCompanyMapper {
    @Autowired
    private LogisticsCompanyServiceImpl ilcsi;

    @PostMapping("/deleteLogisticsCompanyInfo")
    public Result<String> deleteLogisticsCompanyInfo(int logistics_companies_ID) {
        return ilcsi.deleteLogisticsCompanyInfo(logistics_companies_ID);
    }

    @PostMapping("/insertLogisticsCompanyInfo")
    public Result<String> insertLogisticsCompanyInfo(@RequestBody LogisticsCompanyInfo logisticsCompanyInfo) {
        return ilcsi.insertLogisticsCompanyInfo(logisticsCompanyInfo);
    }

    @PostMapping("/selectAllLogisticsCompanyInfo")
    public Result<List<LogisticsCompanyInfo>> selectAllLogisticsCompanyInfo(@Param("pageSize") Integer pageSize, @Param("pageNum") Integer pageNum) {
        return ilcsi.selectAllLogisticsCompanyInfo(pageSize, pageNum);
    }

    @PostMapping("/selectLogisticsCompanyInfo")
    public Result<List<LogisticsCompanyInfo>> selectLogisticsCompanyInfo(@Param("logistics_companies_ID") Integer logistics_companies_ID,
                                                                         @Param("logistics_companies_name") String logistics_companies_name,
                                                                         @Param("logistics_companies_state") Integer logistics_companies_state) {
        return ilcsi.selectLogisticsCompanyInfo(logistics_companies_ID, logistics_companies_name, logistics_companies_state);
    }

    @PostMapping("/updateLogisticsCompanyInfo")
    public Result<String> updateLogisticsCompanyInfo(@RequestBody LogisticsCompanyInfo logisticsCompanyInfo) {
        return ilcsi.updateLogisticsCompanyInfo(logisticsCompanyInfo);
    }
}
